/**
 * Copyright (c) 2016-2021 by the respective copyright holders.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package com.zsmartsystems.zigbee.zcl.clusters.price;

import java.util.Calendar;

import javax.annotation.Generated;

import com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer;
import com.zsmartsystems.zigbee.zcl.ZclFieldSerializer;
import com.zsmartsystems.zigbee.zcl.field.ByteArray;
import com.zsmartsystems.zigbee.zcl.protocol.ZclCommandDirection;
import com.zsmartsystems.zigbee.zcl.protocol.ZclDataType;

/**
 * Publish Price Command value object class.
 * <p>
 * Cluster: <b>Price</b>. Command ID 0x00 is sent <b>FROM</b> the server.
 * This command is a <b>specific</b> command used for the Price cluster.
 * <p>
 * The Publish Price command is generated in response to receiving a Get Current Price command,
 * in response to a Get Scheduled Prices command, and when an update to the pricing information
 * is available from the commodity provider, either before or when a TOU price becomes active.
 * Additionally the Publish Price Command is generated when Block Pricing is in effect. When a
 * Get Current Price or Get Scheduled Prices command is received over a ZigBee Smart Energy
 * network, the Publish Price command should be sent unicast to the requester. In the case of an
 * update to the pricing information from the commodity provider, the Publish Price command
 * should be unicast to all individually registered devices implementing the Price Cluster on
 * the ZigBee Smart Energy network. <br> Devices capable of receiving this command must be
 * capable of storing and supporting at least two pricing information instances, the current
 * active price and the next price. By supporting at least two pricing information instances,
 * receiving devices will allow the Publish Price command generator to publish the next
 * pricing information during the current pricing period. <br> Nested and overlapping
 * Publish Price commands are not allowed. The current active price will be replaced if new
 * price information is received by the ESI. In the case of overlapping events, the event with
 * the newer Issuer Event ID takes priority over all nested and overlapping events. All
 * existing events that overlap, even partially, should be removed. The only exception to this
 * is that if an event with a newer Issuer Event ID overlaps with the end of the current active
 * price but is not yet active, the active price is not deleted but its duration is modified to
 * 0xFFFF (until changed) so that the active price ends when the new event begins.
 * <p>
 * Code is auto-generated. Modifications may be overwritten!
 */
@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2020-12-25T10:11:19Z")
public class PublishPriceCommand extends ZclPriceCommand {
    /**
     * The cluster ID to which this command belongs.
     */
    public static int CLUSTER_ID = 0x0700;

    /**
     * The command ID.
     */
    public static int COMMAND_ID = 0x00;

    /**
     * Provider ID command message field.
     * <p>
     * An unsigned 32-bit field containing a unique identifier for the commodity provider.
     * This field allows differentiation in deregulated markets where multiple commodity
     * providers may be available.
     */
    private Integer providerId;

    /**
     * Rate Label command message field.
     * <p>
     * A ZCL Octet String field capable of storing a 12 character string (the first Octet
     * indicates length) containing commodity provider- specific information regarding
     * the current billing rate. The String shall be encoded in the UTF-8 format. This field
     * allows differentiation when a commodity provider may have multiple pricing plans.
     */
    private ByteArray rateLabel;

    /**
     * Issuer Event ID command message field.
     * <p>
     * Unique identifier generated by the commodity provider. When new pricing information
     * is provided that replaces older pricing information for the same time period, this
     * field allows devices to determine which information is newer. It is expected that the
     * value contained in this field is a unique number managed by upstream servers or a UTC
     * based time stamp (UTCTime data type) identifying when the Publish Price command was
     * issued. Thus, newer pricing information will have a value in the Issuer Event ID field
     * that is larger than older pricing information.
     */
    private Integer issuerEventId;

    /**
     * Current Time command message field.
     * <p>
     * A UTCTime field containing the current time as determined by the device. This field
     * provides an extra value-added feature for the broadcast price signals.
     */
    private Calendar currentTime;

    /**
     * Unit Of Measure command message field.
     * <p>
     * An 8-bit enumeration field identifying the commodity as well as its base unit of
     * measure. The enumeration used for this field shall match one of the UnitOfMeasure
     * values using a pure binary format as defined in the Metering cluster.
     */
    private Integer unitOfMeasure;

    /**
     * Currency command message field.
     * <p>
     * An unsigned 16-bit field containing identifying information concerning the local
     * unit of currency used in the price field. This field allows the displaying of the
     * appropriate symbol for a currency (i.e.: $). The value of the currency field should
     * match the values defined by ISO 4217. Price Trailing Digit and Price Tier (mandatory):
     * An 8-bit field used to determine where the decimal point is located in the price field and
     * to indicate the current pricing tier as chosen by the commodity provider. The most
     * significant nibble is the Trailing Digit sub-field which indicates the number of
     * digits to the right of the decimal point. The least significant nibble is an enumerated
     * field containing the current Price Tier. An 8-bit BitMap where the most significant
     * nibble is an enumerated sub-field representing the maximum number of price tiers
     * available, and the least significant nibble is an enumerated sub-field indicating the
     * register tier used with the current Price Tier. Valid values for the Number of Price
     * Tiers sub-field are from 0 to 15 reflecting no tiers in use (0) to fifteen or more tiers
     * available (15). The meaning of value 0xF is dependant on the value of the optional the
     * Extended Number of Price Tiers field. Absence of this field, or a value of 0x00 in this
     * field, indicates that maximum number of tiers available is fifteen. Where the Extended
     * Number of Price Tiers field contains a non-zero value, the maximum number of tiers
     * available is determined by the sum of the values of the Number of Price Tiers sub-field
     * and the Extended Number of Price Tiers field.
     */
    private Integer currency;

    /**
     * Price Trailing Digit And Tier command message field.
     */
    private Integer priceTrailingDigitAndTier;

    /**
     * Number Of Price Tiers command message field.
     */
    private Integer numberOfPriceTiers;

    /**
     * Start Time command message field.
     * <p>
     * A UTCTime field to denote the time at which the price signal becomes valid. A Start Time of
     * 0x00000000 is a special time denoting “now”. If the device would send a price with a Start
     * Time of now, adjust the Duration In Minutes field to correspond to the remainder of the
     * price. An unsigned 16-bit field used to denote the amount of time in minutes after the
     * Start Time during which the price signal is valid. Maximum value means “until changed”.
     * If Block Charging only is in use, the Duration in Minutes field of the Publish Price
     * command shall be set to 0xFFFF indicating the price is valid “until changed”.
     */
    private Calendar startTime;

    /**
     * Duration command message field.
     */
    private Integer duration;

    /**
     * Price command message field.
     * <p>
     * An unsigned 32-bit field containing the price of the commodity measured in base unit of
     * Currency per Unit of Measure with the decimal point located as indicated by the Price
     * Trailing Digit field when the commodity is delivered to the premises.
     */
    private Integer price;

    /**
     * Price Ratio command message field.
     * <p>
     * An unsigned 8-bit field that gives the ratio of the price denoted in the Price field to the
     * “normal” price chosen by the commodity provider. This field is thought to be useful in
     * situations where CLIENT devices may simply be interested in pricing levels or ratios.
     * The value in this field should be scaled by a factor of 0.1, giving a range of ratios from
     * 0.1 to 25.4. A value of 0xFF indicates the field is not used and 0x00 is an invalid value.
     */
    private Integer priceRatio;

    /**
     * Generation Price command message field.
     * <p>
     * An unsigned 32-bit field containing the price of the commodity measured in base unit of
     * Currency per Unit of Measure with the decimal point located as indicated by the Price
     * Trailing Digit field when the commodity is received from the premises. An example use of
     * this field is in energy markets where the price of electricity from the grid is different
     * than the price of electricity placed on the grid. A value of 0xFFFFFFFF indicates the
     * field is not used.
     */
    private Integer generationPrice;

    /**
     * Generation Price Ratio command message field.
     * <p>
     * An unsigned 8-bit field that gives the ratio of the price denoted in the Generation Price
     * field to the “normal” price chosen by the commodity provider. This field is thought to be
     * useful in situations where CLIENT devices may simply be interested in pricing levels or
     * ratios. The value in this field should be scaled by a factor of 0.1, giving a range of
     * ratios from 0.1 to 25.4 A value of 0xFF indicates the field is not used and 0x00 is an
     * invalid value.
     */
    private Integer generationPriceRatio;

    /**
     * Alternate Cost Delivered command message field.
     * <p>
     * An unsigned 32-bit Integer field that provides a mechanism to describe an alternative
     * measure of the cost of the energy consumed. An example of an Alternate Cost might be the
     * emissions of CO2 for each kWh of electricity consumed providing a measure of the
     * environmental cost. Another example is the emissions of CO2 for each cubic meter of gas
     * consumed (for gas metering). A different value for each price tier may be provided which
     * can be used to reflect the different mix of generation that is associated with different
     * TOU rates. A value of 0xFFFFFFFF indicates the field is not used.
     */
    private Integer alternateCostDelivered;

    /**
     * Alternate Cost Unit command message field.
     * <p>
     * An 8-bit enumeration identifying the unit for the Alternate Cost Delivered field. A
     * value of 0xFF indicates the field is not used.
     */
    private Integer alternateCostUnit;

    /**
     * Alternate Cost Trailing Digit command message field.
     */
    private Integer alternateCostTrailingDigit;

    /**
     * Number Of Block Thresholds command message field.
     */
    private Integer numberOfBlockThresholds;

    /**
     * Price Control command message field.
     */
    private Integer priceControl;

    /**
     * Number Of Generation Tiers command message field.
     */
    private Integer numberOfGenerationTiers;

    /**
     * Generation Tier command message field.
     */
    private Integer generationTier;

    /**
     * Extended Number Of Price Tiers command message field.
     */
    private Integer extendedNumberOfPriceTiers;

    /**
     * Extended Price Tier command message field.
     */
    private Integer extendedPriceTier;

    /**
     * Extended Register Tier command message field.
     */
    private Integer extendedRegisterTier;

    /**
     * Default constructor.
     *
     * @deprecated from release 1.3.0. Use the parameterised constructor instead of the default constructor and setters.
     */
    @Deprecated
    public PublishPriceCommand() {
        clusterId = CLUSTER_ID;
        commandId = COMMAND_ID;
        genericCommand = false;
        commandDirection = ZclCommandDirection.SERVER_TO_CLIENT;
    }

    /**
     * Constructor providing all required parameters.
     *
     * @param providerId {@link Integer} Provider ID
     * @param rateLabel {@link ByteArray} Rate Label
     * @param issuerEventId {@link Integer} Issuer Event ID
     * @param currentTime {@link Calendar} Current Time
     * @param unitOfMeasure {@link Integer} Unit Of Measure
     * @param currency {@link Integer} Currency
     * @param priceTrailingDigitAndTier {@link Integer} Price Trailing Digit And Tier
     * @param numberOfPriceTiers {@link Integer} Number Of Price Tiers
     * @param startTime {@link Calendar} Start Time
     * @param duration {@link Integer} Duration
     * @param price {@link Integer} Price
     * @param priceRatio {@link Integer} Price Ratio
     * @param generationPrice {@link Integer} Generation Price
     * @param generationPriceRatio {@link Integer} Generation Price Ratio
     * @param alternateCostDelivered {@link Integer} Alternate Cost Delivered
     * @param alternateCostUnit {@link Integer} Alternate Cost Unit
     * @param alternateCostTrailingDigit {@link Integer} Alternate Cost Trailing Digit
     * @param numberOfBlockThresholds {@link Integer} Number Of Block Thresholds
     * @param priceControl {@link Integer} Price Control
     * @param numberOfGenerationTiers {@link Integer} Number Of Generation Tiers
     * @param generationTier {@link Integer} Generation Tier
     * @param extendedNumberOfPriceTiers {@link Integer} Extended Number Of Price Tiers
     * @param extendedPriceTier {@link Integer} Extended Price Tier
     * @param extendedRegisterTier {@link Integer} Extended Register Tier
     */
    public PublishPriceCommand(
            Integer providerId,
            ByteArray rateLabel,
            Integer issuerEventId,
            Calendar currentTime,
            Integer unitOfMeasure,
            Integer currency,
            Integer priceTrailingDigitAndTier,
            Integer numberOfPriceTiers,
            Calendar startTime,
            Integer duration,
            Integer price,
            Integer priceRatio,
            Integer generationPrice,
            Integer generationPriceRatio,
            Integer alternateCostDelivered,
            Integer alternateCostUnit,
            Integer alternateCostTrailingDigit,
            Integer numberOfBlockThresholds,
            Integer priceControl,
            Integer numberOfGenerationTiers,
            Integer generationTier,
            Integer extendedNumberOfPriceTiers,
            Integer extendedPriceTier,
            Integer extendedRegisterTier) {

        clusterId = CLUSTER_ID;
        commandId = COMMAND_ID;
        genericCommand = false;
        commandDirection = ZclCommandDirection.SERVER_TO_CLIENT;

        this.providerId = providerId;
        this.rateLabel = rateLabel;
        this.issuerEventId = issuerEventId;
        this.currentTime = currentTime;
        this.unitOfMeasure = unitOfMeasure;
        this.currency = currency;
        this.priceTrailingDigitAndTier = priceTrailingDigitAndTier;
        this.numberOfPriceTiers = numberOfPriceTiers;
        this.startTime = startTime;
        this.duration = duration;
        this.price = price;
        this.priceRatio = priceRatio;
        this.generationPrice = generationPrice;
        this.generationPriceRatio = generationPriceRatio;
        this.alternateCostDelivered = alternateCostDelivered;
        this.alternateCostUnit = alternateCostUnit;
        this.alternateCostTrailingDigit = alternateCostTrailingDigit;
        this.numberOfBlockThresholds = numberOfBlockThresholds;
        this.priceControl = priceControl;
        this.numberOfGenerationTiers = numberOfGenerationTiers;
        this.generationTier = generationTier;
        this.extendedNumberOfPriceTiers = extendedNumberOfPriceTiers;
        this.extendedPriceTier = extendedPriceTier;
        this.extendedRegisterTier = extendedRegisterTier;
    }

    /**
     * Gets Provider ID.
     * <p>
     * An unsigned 32-bit field containing a unique identifier for the commodity provider.
     * This field allows differentiation in deregulated markets where multiple commodity
     * providers may be available.
     *
     * @return the Provider ID
     */
    public Integer getProviderId() {
        return providerId;
    }

    /**
     * Sets Provider ID.
     * <p>
     * An unsigned 32-bit field containing a unique identifier for the commodity provider.
     * This field allows differentiation in deregulated markets where multiple commodity
     * providers may be available.
     *
     * @param providerId the Provider ID
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setProviderId(final Integer providerId) {
        this.providerId = providerId;
    }

    /**
     * Gets Rate Label.
     * <p>
     * A ZCL Octet String field capable of storing a 12 character string (the first Octet
     * indicates length) containing commodity provider- specific information regarding
     * the current billing rate. The String shall be encoded in the UTF-8 format. This field
     * allows differentiation when a commodity provider may have multiple pricing plans.
     *
     * @return the Rate Label
     */
    public ByteArray getRateLabel() {
        return rateLabel;
    }

    /**
     * Sets Rate Label.
     * <p>
     * A ZCL Octet String field capable of storing a 12 character string (the first Octet
     * indicates length) containing commodity provider- specific information regarding
     * the current billing rate. The String shall be encoded in the UTF-8 format. This field
     * allows differentiation when a commodity provider may have multiple pricing plans.
     *
     * @param rateLabel the Rate Label
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setRateLabel(final ByteArray rateLabel) {
        this.rateLabel = rateLabel;
    }

    /**
     * Gets Issuer Event ID.
     * <p>
     * Unique identifier generated by the commodity provider. When new pricing information
     * is provided that replaces older pricing information for the same time period, this
     * field allows devices to determine which information is newer. It is expected that the
     * value contained in this field is a unique number managed by upstream servers or a UTC
     * based time stamp (UTCTime data type) identifying when the Publish Price command was
     * issued. Thus, newer pricing information will have a value in the Issuer Event ID field
     * that is larger than older pricing information.
     *
     * @return the Issuer Event ID
     */
    public Integer getIssuerEventId() {
        return issuerEventId;
    }

    /**
     * Sets Issuer Event ID.
     * <p>
     * Unique identifier generated by the commodity provider. When new pricing information
     * is provided that replaces older pricing information for the same time period, this
     * field allows devices to determine which information is newer. It is expected that the
     * value contained in this field is a unique number managed by upstream servers or a UTC
     * based time stamp (UTCTime data type) identifying when the Publish Price command was
     * issued. Thus, newer pricing information will have a value in the Issuer Event ID field
     * that is larger than older pricing information.
     *
     * @param issuerEventId the Issuer Event ID
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setIssuerEventId(final Integer issuerEventId) {
        this.issuerEventId = issuerEventId;
    }

    /**
     * Gets Current Time.
     * <p>
     * A UTCTime field containing the current time as determined by the device. This field
     * provides an extra value-added feature for the broadcast price signals.
     *
     * @return the Current Time
     */
    public Calendar getCurrentTime() {
        return currentTime;
    }

    /**
     * Sets Current Time.
     * <p>
     * A UTCTime field containing the current time as determined by the device. This field
     * provides an extra value-added feature for the broadcast price signals.
     *
     * @param currentTime the Current Time
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setCurrentTime(final Calendar currentTime) {
        this.currentTime = currentTime;
    }

    /**
     * Gets Unit Of Measure.
     * <p>
     * An 8-bit enumeration field identifying the commodity as well as its base unit of
     * measure. The enumeration used for this field shall match one of the UnitOfMeasure
     * values using a pure binary format as defined in the Metering cluster.
     *
     * @return the Unit Of Measure
     */
    public Integer getUnitOfMeasure() {
        return unitOfMeasure;
    }

    /**
     * Sets Unit Of Measure.
     * <p>
     * An 8-bit enumeration field identifying the commodity as well as its base unit of
     * measure. The enumeration used for this field shall match one of the UnitOfMeasure
     * values using a pure binary format as defined in the Metering cluster.
     *
     * @param unitOfMeasure the Unit Of Measure
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setUnitOfMeasure(final Integer unitOfMeasure) {
        this.unitOfMeasure = unitOfMeasure;
    }

    /**
     * Gets Currency.
     * <p>
     * An unsigned 16-bit field containing identifying information concerning the local
     * unit of currency used in the price field. This field allows the displaying of the
     * appropriate symbol for a currency (i.e.: $). The value of the currency field should
     * match the values defined by ISO 4217. Price Trailing Digit and Price Tier (mandatory):
     * An 8-bit field used to determine where the decimal point is located in the price field and
     * to indicate the current pricing tier as chosen by the commodity provider. The most
     * significant nibble is the Trailing Digit sub-field which indicates the number of
     * digits to the right of the decimal point. The least significant nibble is an enumerated
     * field containing the current Price Tier. An 8-bit BitMap where the most significant
     * nibble is an enumerated sub-field representing the maximum number of price tiers
     * available, and the least significant nibble is an enumerated sub-field indicating the
     * register tier used with the current Price Tier. Valid values for the Number of Price
     * Tiers sub-field are from 0 to 15 reflecting no tiers in use (0) to fifteen or more tiers
     * available (15). The meaning of value 0xF is dependant on the value of the optional the
     * Extended Number of Price Tiers field. Absence of this field, or a value of 0x00 in this
     * field, indicates that maximum number of tiers available is fifteen. Where the Extended
     * Number of Price Tiers field contains a non-zero value, the maximum number of tiers
     * available is determined by the sum of the values of the Number of Price Tiers sub-field
     * and the Extended Number of Price Tiers field.
     *
     * @return the Currency
     */
    public Integer getCurrency() {
        return currency;
    }

    /**
     * Sets Currency.
     * <p>
     * An unsigned 16-bit field containing identifying information concerning the local
     * unit of currency used in the price field. This field allows the displaying of the
     * appropriate symbol for a currency (i.e.: $). The value of the currency field should
     * match the values defined by ISO 4217. Price Trailing Digit and Price Tier (mandatory):
     * An 8-bit field used to determine where the decimal point is located in the price field and
     * to indicate the current pricing tier as chosen by the commodity provider. The most
     * significant nibble is the Trailing Digit sub-field which indicates the number of
     * digits to the right of the decimal point. The least significant nibble is an enumerated
     * field containing the current Price Tier. An 8-bit BitMap where the most significant
     * nibble is an enumerated sub-field representing the maximum number of price tiers
     * available, and the least significant nibble is an enumerated sub-field indicating the
     * register tier used with the current Price Tier. Valid values for the Number of Price
     * Tiers sub-field are from 0 to 15 reflecting no tiers in use (0) to fifteen or more tiers
     * available (15). The meaning of value 0xF is dependant on the value of the optional the
     * Extended Number of Price Tiers field. Absence of this field, or a value of 0x00 in this
     * field, indicates that maximum number of tiers available is fifteen. Where the Extended
     * Number of Price Tiers field contains a non-zero value, the maximum number of tiers
     * available is determined by the sum of the values of the Number of Price Tiers sub-field
     * and the Extended Number of Price Tiers field.
     *
     * @param currency the Currency
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setCurrency(final Integer currency) {
        this.currency = currency;
    }

    /**
     * Gets Price Trailing Digit And Tier.
     *
     * @return the Price Trailing Digit And Tier
     */
    public Integer getPriceTrailingDigitAndTier() {
        return priceTrailingDigitAndTier;
    }

    /**
     * Sets Price Trailing Digit And Tier.
     *
     * @param priceTrailingDigitAndTier the Price Trailing Digit And Tier
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setPriceTrailingDigitAndTier(final Integer priceTrailingDigitAndTier) {
        this.priceTrailingDigitAndTier = priceTrailingDigitAndTier;
    }

    /**
     * Gets Number Of Price Tiers.
     *
     * @return the Number Of Price Tiers
     */
    public Integer getNumberOfPriceTiers() {
        return numberOfPriceTiers;
    }

    /**
     * Sets Number Of Price Tiers.
     *
     * @param numberOfPriceTiers the Number Of Price Tiers
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setNumberOfPriceTiers(final Integer numberOfPriceTiers) {
        this.numberOfPriceTiers = numberOfPriceTiers;
    }

    /**
     * Gets Start Time.
     * <p>
     * A UTCTime field to denote the time at which the price signal becomes valid. A Start Time of
     * 0x00000000 is a special time denoting “now”. If the device would send a price with a Start
     * Time of now, adjust the Duration In Minutes field to correspond to the remainder of the
     * price. An unsigned 16-bit field used to denote the amount of time in minutes after the
     * Start Time during which the price signal is valid. Maximum value means “until changed”.
     * If Block Charging only is in use, the Duration in Minutes field of the Publish Price
     * command shall be set to 0xFFFF indicating the price is valid “until changed”.
     *
     * @return the Start Time
     */
    public Calendar getStartTime() {
        return startTime;
    }

    /**
     * Sets Start Time.
     * <p>
     * A UTCTime field to denote the time at which the price signal becomes valid. A Start Time of
     * 0x00000000 is a special time denoting “now”. If the device would send a price with a Start
     * Time of now, adjust the Duration In Minutes field to correspond to the remainder of the
     * price. An unsigned 16-bit field used to denote the amount of time in minutes after the
     * Start Time during which the price signal is valid. Maximum value means “until changed”.
     * If Block Charging only is in use, the Duration in Minutes field of the Publish Price
     * command shall be set to 0xFFFF indicating the price is valid “until changed”.
     *
     * @param startTime the Start Time
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setStartTime(final Calendar startTime) {
        this.startTime = startTime;
    }

    /**
     * Gets Duration.
     *
     * @return the Duration
     */
    public Integer getDuration() {
        return duration;
    }

    /**
     * Sets Duration.
     *
     * @param duration the Duration
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setDuration(final Integer duration) {
        this.duration = duration;
    }

    /**
     * Gets Price.
     * <p>
     * An unsigned 32-bit field containing the price of the commodity measured in base unit of
     * Currency per Unit of Measure with the decimal point located as indicated by the Price
     * Trailing Digit field when the commodity is delivered to the premises.
     *
     * @return the Price
     */
    public Integer getPrice() {
        return price;
    }

    /**
     * Sets Price.
     * <p>
     * An unsigned 32-bit field containing the price of the commodity measured in base unit of
     * Currency per Unit of Measure with the decimal point located as indicated by the Price
     * Trailing Digit field when the commodity is delivered to the premises.
     *
     * @param price the Price
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setPrice(final Integer price) {
        this.price = price;
    }

    /**
     * Gets Price Ratio.
     * <p>
     * An unsigned 8-bit field that gives the ratio of the price denoted in the Price field to the
     * “normal” price chosen by the commodity provider. This field is thought to be useful in
     * situations where CLIENT devices may simply be interested in pricing levels or ratios.
     * The value in this field should be scaled by a factor of 0.1, giving a range of ratios from
     * 0.1 to 25.4. A value of 0xFF indicates the field is not used and 0x00 is an invalid value.
     *
     * @return the Price Ratio
     */
    public Integer getPriceRatio() {
        return priceRatio;
    }

    /**
     * Sets Price Ratio.
     * <p>
     * An unsigned 8-bit field that gives the ratio of the price denoted in the Price field to the
     * “normal” price chosen by the commodity provider. This field is thought to be useful in
     * situations where CLIENT devices may simply be interested in pricing levels or ratios.
     * The value in this field should be scaled by a factor of 0.1, giving a range of ratios from
     * 0.1 to 25.4. A value of 0xFF indicates the field is not used and 0x00 is an invalid value.
     *
     * @param priceRatio the Price Ratio
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setPriceRatio(final Integer priceRatio) {
        this.priceRatio = priceRatio;
    }

    /**
     * Gets Generation Price.
     * <p>
     * An unsigned 32-bit field containing the price of the commodity measured in base unit of
     * Currency per Unit of Measure with the decimal point located as indicated by the Price
     * Trailing Digit field when the commodity is received from the premises. An example use of
     * this field is in energy markets where the price of electricity from the grid is different
     * than the price of electricity placed on the grid. A value of 0xFFFFFFFF indicates the
     * field is not used.
     *
     * @return the Generation Price
     */
    public Integer getGenerationPrice() {
        return generationPrice;
    }

    /**
     * Sets Generation Price.
     * <p>
     * An unsigned 32-bit field containing the price of the commodity measured in base unit of
     * Currency per Unit of Measure with the decimal point located as indicated by the Price
     * Trailing Digit field when the commodity is received from the premises. An example use of
     * this field is in energy markets where the price of electricity from the grid is different
     * than the price of electricity placed on the grid. A value of 0xFFFFFFFF indicates the
     * field is not used.
     *
     * @param generationPrice the Generation Price
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setGenerationPrice(final Integer generationPrice) {
        this.generationPrice = generationPrice;
    }

    /**
     * Gets Generation Price Ratio.
     * <p>
     * An unsigned 8-bit field that gives the ratio of the price denoted in the Generation Price
     * field to the “normal” price chosen by the commodity provider. This field is thought to be
     * useful in situations where CLIENT devices may simply be interested in pricing levels or
     * ratios. The value in this field should be scaled by a factor of 0.1, giving a range of
     * ratios from 0.1 to 25.4 A value of 0xFF indicates the field is not used and 0x00 is an
     * invalid value.
     *
     * @return the Generation Price Ratio
     */
    public Integer getGenerationPriceRatio() {
        return generationPriceRatio;
    }

    /**
     * Sets Generation Price Ratio.
     * <p>
     * An unsigned 8-bit field that gives the ratio of the price denoted in the Generation Price
     * field to the “normal” price chosen by the commodity provider. This field is thought to be
     * useful in situations where CLIENT devices may simply be interested in pricing levels or
     * ratios. The value in this field should be scaled by a factor of 0.1, giving a range of
     * ratios from 0.1 to 25.4 A value of 0xFF indicates the field is not used and 0x00 is an
     * invalid value.
     *
     * @param generationPriceRatio the Generation Price Ratio
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setGenerationPriceRatio(final Integer generationPriceRatio) {
        this.generationPriceRatio = generationPriceRatio;
    }

    /**
     * Gets Alternate Cost Delivered.
     * <p>
     * An unsigned 32-bit Integer field that provides a mechanism to describe an alternative
     * measure of the cost of the energy consumed. An example of an Alternate Cost might be the
     * emissions of CO2 for each kWh of electricity consumed providing a measure of the
     * environmental cost. Another example is the emissions of CO2 for each cubic meter of gas
     * consumed (for gas metering). A different value for each price tier may be provided which
     * can be used to reflect the different mix of generation that is associated with different
     * TOU rates. A value of 0xFFFFFFFF indicates the field is not used.
     *
     * @return the Alternate Cost Delivered
     */
    public Integer getAlternateCostDelivered() {
        return alternateCostDelivered;
    }

    /**
     * Sets Alternate Cost Delivered.
     * <p>
     * An unsigned 32-bit Integer field that provides a mechanism to describe an alternative
     * measure of the cost of the energy consumed. An example of an Alternate Cost might be the
     * emissions of CO2 for each kWh of electricity consumed providing a measure of the
     * environmental cost. Another example is the emissions of CO2 for each cubic meter of gas
     * consumed (for gas metering). A different value for each price tier may be provided which
     * can be used to reflect the different mix of generation that is associated with different
     * TOU rates. A value of 0xFFFFFFFF indicates the field is not used.
     *
     * @param alternateCostDelivered the Alternate Cost Delivered
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setAlternateCostDelivered(final Integer alternateCostDelivered) {
        this.alternateCostDelivered = alternateCostDelivered;
    }

    /**
     * Gets Alternate Cost Unit.
     * <p>
     * An 8-bit enumeration identifying the unit for the Alternate Cost Delivered field. A
     * value of 0xFF indicates the field is not used.
     *
     * @return the Alternate Cost Unit
     */
    public Integer getAlternateCostUnit() {
        return alternateCostUnit;
    }

    /**
     * Sets Alternate Cost Unit.
     * <p>
     * An 8-bit enumeration identifying the unit for the Alternate Cost Delivered field. A
     * value of 0xFF indicates the field is not used.
     *
     * @param alternateCostUnit the Alternate Cost Unit
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setAlternateCostUnit(final Integer alternateCostUnit) {
        this.alternateCostUnit = alternateCostUnit;
    }

    /**
     * Gets Alternate Cost Trailing Digit.
     *
     * @return the Alternate Cost Trailing Digit
     */
    public Integer getAlternateCostTrailingDigit() {
        return alternateCostTrailingDigit;
    }

    /**
     * Sets Alternate Cost Trailing Digit.
     *
     * @param alternateCostTrailingDigit the Alternate Cost Trailing Digit
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setAlternateCostTrailingDigit(final Integer alternateCostTrailingDigit) {
        this.alternateCostTrailingDigit = alternateCostTrailingDigit;
    }

    /**
     * Gets Number Of Block Thresholds.
     *
     * @return the Number Of Block Thresholds
     */
    public Integer getNumberOfBlockThresholds() {
        return numberOfBlockThresholds;
    }

    /**
     * Sets Number Of Block Thresholds.
     *
     * @param numberOfBlockThresholds the Number Of Block Thresholds
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setNumberOfBlockThresholds(final Integer numberOfBlockThresholds) {
        this.numberOfBlockThresholds = numberOfBlockThresholds;
    }

    /**
     * Gets Price Control.
     *
     * @return the Price Control
     */
    public Integer getPriceControl() {
        return priceControl;
    }

    /**
     * Sets Price Control.
     *
     * @param priceControl the Price Control
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setPriceControl(final Integer priceControl) {
        this.priceControl = priceControl;
    }

    /**
     * Gets Number Of Generation Tiers.
     *
     * @return the Number Of Generation Tiers
     */
    public Integer getNumberOfGenerationTiers() {
        return numberOfGenerationTiers;
    }

    /**
     * Sets Number Of Generation Tiers.
     *
     * @param numberOfGenerationTiers the Number Of Generation Tiers
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setNumberOfGenerationTiers(final Integer numberOfGenerationTiers) {
        this.numberOfGenerationTiers = numberOfGenerationTiers;
    }

    /**
     * Gets Generation Tier.
     *
     * @return the Generation Tier
     */
    public Integer getGenerationTier() {
        return generationTier;
    }

    /**
     * Sets Generation Tier.
     *
     * @param generationTier the Generation Tier
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setGenerationTier(final Integer generationTier) {
        this.generationTier = generationTier;
    }

    /**
     * Gets Extended Number Of Price Tiers.
     *
     * @return the Extended Number Of Price Tiers
     */
    public Integer getExtendedNumberOfPriceTiers() {
        return extendedNumberOfPriceTiers;
    }

    /**
     * Sets Extended Number Of Price Tiers.
     *
     * @param extendedNumberOfPriceTiers the Extended Number Of Price Tiers
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setExtendedNumberOfPriceTiers(final Integer extendedNumberOfPriceTiers) {
        this.extendedNumberOfPriceTiers = extendedNumberOfPriceTiers;
    }

    /**
     * Gets Extended Price Tier.
     *
     * @return the Extended Price Tier
     */
    public Integer getExtendedPriceTier() {
        return extendedPriceTier;
    }

    /**
     * Sets Extended Price Tier.
     *
     * @param extendedPriceTier the Extended Price Tier
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setExtendedPriceTier(final Integer extendedPriceTier) {
        this.extendedPriceTier = extendedPriceTier;
    }

    /**
     * Gets Extended Register Tier.
     *
     * @return the Extended Register Tier
     */
    public Integer getExtendedRegisterTier() {
        return extendedRegisterTier;
    }

    /**
     * Sets Extended Register Tier.
     *
     * @param extendedRegisterTier the Extended Register Tier
     * @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
     */
    @Deprecated
    public void setExtendedRegisterTier(final Integer extendedRegisterTier) {
        this.extendedRegisterTier = extendedRegisterTier;
    }

    @Override
    public void serialize(final ZclFieldSerializer serializer) {
        serializer.serialize(providerId, ZclDataType.UNSIGNED_32_BIT_INTEGER);
        serializer.serialize(rateLabel, ZclDataType.OCTET_STRING);
        serializer.serialize(issuerEventId, ZclDataType.UNSIGNED_32_BIT_INTEGER);
        serializer.serialize(currentTime, ZclDataType.UTCTIME);
        serializer.serialize(unitOfMeasure, ZclDataType.ENUMERATION_8_BIT);
        serializer.serialize(currency, ZclDataType.UNSIGNED_16_BIT_INTEGER);
        serializer.serialize(priceTrailingDigitAndTier, ZclDataType.BITMAP_8_BIT);
        serializer.serialize(numberOfPriceTiers, ZclDataType.BITMAP_8_BIT);
        serializer.serialize(startTime, ZclDataType.UTCTIME);
        serializer.serialize(duration, ZclDataType.UNSIGNED_16_BIT_INTEGER);
        serializer.serialize(price, ZclDataType.UNSIGNED_32_BIT_INTEGER);
        serializer.serialize(priceRatio, ZclDataType.UNSIGNED_8_BIT_INTEGER);
        serializer.serialize(generationPrice, ZclDataType.UNSIGNED_32_BIT_INTEGER);
        serializer.serialize(generationPriceRatio, ZclDataType.UNSIGNED_32_BIT_INTEGER);
        serializer.serialize(alternateCostDelivered, ZclDataType.UNSIGNED_32_BIT_INTEGER);
        serializer.serialize(alternateCostUnit, ZclDataType.ENUMERATION_8_BIT);
        serializer.serialize(alternateCostTrailingDigit, ZclDataType.BITMAP_8_BIT);
        serializer.serialize(numberOfBlockThresholds, ZclDataType.UNSIGNED_8_BIT_INTEGER);
        serializer.serialize(priceControl, ZclDataType.BITMAP_8_BIT);
        serializer.serialize(numberOfGenerationTiers, ZclDataType.UNSIGNED_8_BIT_INTEGER);
        serializer.serialize(generationTier, ZclDataType.ENUMERATION_8_BIT);
        serializer.serialize(extendedNumberOfPriceTiers, ZclDataType.ENUMERATION_8_BIT);
        serializer.serialize(extendedPriceTier, ZclDataType.ENUMERATION_8_BIT);
        serializer.serialize(extendedRegisterTier, ZclDataType.ENUMERATION_8_BIT);
    }

    @Override
    public void deserialize(final ZclFieldDeserializer deserializer) {
        providerId = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_32_BIT_INTEGER);
        rateLabel = (ByteArray) deserializer.deserialize(ZclDataType.OCTET_STRING);
        issuerEventId = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_32_BIT_INTEGER);
        currentTime = (Calendar) deserializer.deserialize(ZclDataType.UTCTIME);
        unitOfMeasure = (Integer) deserializer.deserialize(ZclDataType.ENUMERATION_8_BIT);
        currency = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_16_BIT_INTEGER);
        priceTrailingDigitAndTier = (Integer) deserializer.deserialize(ZclDataType.BITMAP_8_BIT);
        numberOfPriceTiers = (Integer) deserializer.deserialize(ZclDataType.BITMAP_8_BIT);
        startTime = (Calendar) deserializer.deserialize(ZclDataType.UTCTIME);
        duration = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_16_BIT_INTEGER);
        price = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_32_BIT_INTEGER);
        priceRatio = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_8_BIT_INTEGER);
        generationPrice = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_32_BIT_INTEGER);
        generationPriceRatio = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_32_BIT_INTEGER);
        alternateCostDelivered = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_32_BIT_INTEGER);
        alternateCostUnit = (Integer) deserializer.deserialize(ZclDataType.ENUMERATION_8_BIT);
        alternateCostTrailingDigit = (Integer) deserializer.deserialize(ZclDataType.BITMAP_8_BIT);
        numberOfBlockThresholds = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_8_BIT_INTEGER);
        priceControl = (Integer) deserializer.deserialize(ZclDataType.BITMAP_8_BIT);
        numberOfGenerationTiers = (Integer) deserializer.deserialize(ZclDataType.UNSIGNED_8_BIT_INTEGER);
        generationTier = (Integer) deserializer.deserialize(ZclDataType.ENUMERATION_8_BIT);
        extendedNumberOfPriceTiers = (Integer) deserializer.deserialize(ZclDataType.ENUMERATION_8_BIT);
        extendedPriceTier = (Integer) deserializer.deserialize(ZclDataType.ENUMERATION_8_BIT);
        extendedRegisterTier = (Integer) deserializer.deserialize(ZclDataType.ENUMERATION_8_BIT);
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder(876);
        builder.append("PublishPriceCommand [");
        builder.append(super.toString());
        builder.append(", providerId=");
        builder.append(providerId);
        builder.append(", rateLabel=");
        builder.append(rateLabel);
        builder.append(", issuerEventId=");
        builder.append(issuerEventId);
        builder.append(", currentTime=");
        builder.append(currentTime);
        builder.append(", unitOfMeasure=");
        builder.append(unitOfMeasure);
        builder.append(", currency=");
        builder.append(currency);
        builder.append(", priceTrailingDigitAndTier=");
        builder.append(priceTrailingDigitAndTier);
        builder.append(", numberOfPriceTiers=");
        builder.append(numberOfPriceTiers);
        builder.append(", startTime=");
        builder.append(startTime);
        builder.append(", duration=");
        builder.append(duration);
        builder.append(", price=");
        builder.append(price);
        builder.append(", priceRatio=");
        builder.append(priceRatio);
        builder.append(", generationPrice=");
        builder.append(generationPrice);
        builder.append(", generationPriceRatio=");
        builder.append(generationPriceRatio);
        builder.append(", alternateCostDelivered=");
        builder.append(alternateCostDelivered);
        builder.append(", alternateCostUnit=");
        builder.append(alternateCostUnit);
        builder.append(", alternateCostTrailingDigit=");
        builder.append(alternateCostTrailingDigit);
        builder.append(", numberOfBlockThresholds=");
        builder.append(numberOfBlockThresholds);
        builder.append(", priceControl=");
        builder.append(priceControl);
        builder.append(", numberOfGenerationTiers=");
        builder.append(numberOfGenerationTiers);
        builder.append(", generationTier=");
        builder.append(generationTier);
        builder.append(", extendedNumberOfPriceTiers=");
        builder.append(extendedNumberOfPriceTiers);
        builder.append(", extendedPriceTier=");
        builder.append(extendedPriceTier);
        builder.append(", extendedRegisterTier=");
        builder.append(extendedRegisterTier);
        builder.append(']');
        return builder.toString();
    }

}
